package com.linchong.concurrency.chapter4;

import java.util.Optional;

/**
 * @Author:linchong
 * @CreateTime:2020-01-03 14:45
 * @Description: 简单的API
 */
public class ThreadSimpleAPI {
	public static void main(String[] args) {
		Thread t = new Thread(() -> {
			Optional.of("hello").ifPresent(System.out::println);
			try {
				Thread.sleep(10_000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}, "t1");
		t.start();
		Optional.of(t.getName()).ifPresent(System.out::println);
		Optional.of(t.getId()).ifPresent(System.out::println);
		Optional.of(t.getPriority()).ifPresent(System.out::println);
		Optional.of(t.getState()).ifPresent(System.out::println);
	}
}
